<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <!-- load css -->
    <link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/css/font/iconfont.css}" media="all"/>
    <link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/js/layui/css/layui.css}"  media="all"/>
    <link rel="stylesheet" type="text/css" th:href="@{/plugin/bootstrap/bootstrap/css/bootstrap.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/plugin/bootstrap-table/bootstrap-table.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/table.css}"  media="all"/>
    <link rel="stylesheet" type="text/css" th:href="@{/plugin/bootstrap/bootstrap/css/bootstrap.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/js/select2/css/select2.css}" media="all"/>

    <style>
        h2{
            margin: 0;
        }
        .blocks{
            display: flex;
            flex-direction: column;
            width: 15rem;
        }
        .blockout{
            display: flex;
            justify-content: space-around;
            margin: 1.5rem 0;
        }
        input[type="text"]:disabled{
            background-color: #EEF1F6;
        }
    </style>
</head>
<body>
<div class="layui-fluid larry-wrapper" id="StandardVUE">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item" style="margin: 2rem 0 1rem 0; height: 6rem;">
                        <div class="layui-inline" style="height: 6rem;">
                            <label class="layui-form-label">包装名称</label>
                            <div class="layui-input-inline">
                                <input type="text" id="packName" name="packName"  required="required" jq-verify="required" lay-verify="required" placeholder="包装名称" autocomplete="off" class="layui-input "/>
                            </div>
                        </div>
                        <div class="layui-inline" style="height: 6rem;">
                            <label class="layui-form-label">包装描述</label>
                            <div class="layui-input-inline">
                                <input type="text" id="packDescribe" name="packDescribe"  required="required" jq-verify="required" lay-verify="required" placeholder="包装描述" autocomplete="off" class="layui-input "/>
                            </div>
                        </div>
                    </div>
                    <div class="layui-collapse" lay-filter="test">
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">主单位</h2>
                            <div class="layui-colla-content layui-show">
                                <div class="blockout">
                                    <input type="hidden" id="mxid1" name="mxid1"/>
                                    <div class="blocks">
                                        <label>数量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" disabled class="layui-input" name="number1" id="number1" value="1" lay-verify="zhengshu" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>包装描述</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="describe1" id="describe1" jq-verify="required"  placeholder="包装描述" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>长(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="length1" id="length1" lay-verify="nonnegative" placeholder="长(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>宽(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="width1" id="width1" lay-verify="nonnegative" placeholder="宽(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>高(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="height1" id="height1" lay-verify="nonnegative" placeholder="高(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>体积</label>
                                        <div class="layui-input-inline">
                                            <span id="volume1" style="font-size: 1.5rem; line-height: 3rem"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="blockout" style=" width: 50%;">
                                    <div class="blocks">
                                        <label>毛重量(克)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="rough1" id="rough1" lay-verify="nonnegative" placeholder="毛重量(克)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>净重量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="suttle1" id="suttle1" lay-verify="nonnegative" placeholder="净重量" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>金额</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="money1" id="money1"  placeholder="金额" lay-verify="nonnegative" value="0" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">内包装</h2>
                            <div class="layui-colla-content layui-show">
                                <div class="blockout">
                                    <input type="hidden" id="mxid2" name="mxid2"/>
                                    <div class="blocks">
                                        <label>数量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="number2" id="number2" value="1" lay-verify="zhengshu2" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>包装描述</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="describe2" id="describe2" jq-verify="required" placeholder="包装描述" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>长(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="length2" id="length2" lay-verify="nonnegative" placeholder="长(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>宽(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="width2" id="width2" lay-verify="nonnegative" placeholder="宽(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>高(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="height2" id="height2" lay-verify="nonnegative" placeholder="高(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>体积</label>
                                        <div class="layui-input-inline">
                                            <span id="volume2" style="font-size: 1.5rem; line-height: 3rem"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="blockout" style=" width: 50%;">
                                    <div class="blocks">
                                        <label>毛重量(克)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="rough2" id="rough2" lay-verify="nonnegative" placeholder="毛重量(克)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>净重量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="suttle2" id="suttle2" lay-verify="nonnegative"  placeholder="净重量" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>金额</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="money2" id="money2" lay-verify="nonnegative" placeholder="金额" value="0" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">箱</h2>
                            <div class="layui-colla-content layui-show">
                                <div class="blockout">
                                    <input type="hidden" id="mxid3" name="mxid3"/>
                                    <div class="blocks">
                                        <label>数量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="number3" id="number3" value="1" lay-verify="zhengshu"/>
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>包装描述</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="describe3" id="describe3" placeholder="包装描述"  value="箱" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>长(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="length3" id="length3" lay-verify="nonnegative" placeholder="长(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>宽(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="width3" id="width3" lay-verify="nonnegative" placeholder="宽(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>高(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="height3" id="height3" lay-verify="nonnegative" placeholder="高(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>体积</label>
                                        <div class="layui-input-inline">
                                            <span id="volume3" style="font-size: 1.5rem; line-height: 3rem"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="blockout" style=" width: 50%;">
                                    <div class="blocks">
                                        <label>毛重量(克)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="rough3" id="rough3" lay-verify="nonnegative" placeholder="毛重量(克)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>净重量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="suttle3" id="suttle3" lay-verify="nonnegative" placeholder="净重量" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>金额</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="money3" id="money3" lay-verify="nonnegative" placeholder="金额" value="0" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">托盘</h2>
                            <div class="layui-colla-content layui-show">
                                <div class="blockout">
                                    <input type="hidden" id="mxid4" name="mxid4"/>
                                    <div class="blocks">
                                        <label>数量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="number4" id="number4" value="1" lay-verify="zhengshu2"/>
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>包装描述</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="describe4" id="describe4" placeholder="包装描述" value="托" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>长(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="length4" id="length4" lay-verify="nonnegative" placeholder="长(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>宽(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="width4" id="width4" lay-verify="nonnegative" placeholder="宽(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>高(厘米)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="height4" id="height4" lay-verify="nonnegative" placeholder="高(厘米)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>体积</label>
                                        <div class="layui-input-inline">
                                            <span id="volume4" style="font-size: 1.5rem; line-height: 3rem"></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="blockout" style=" width: 66.5%;">
                                    <div class="blocks">
                                        <label>毛重量(克)</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="rough4" id="rough4" lay-verify="nonnegative" placeholder="毛重量(克)" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>净重量</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="suttle4" id="suttle4" lay-verify="nonnegative" placeholder="净重量" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>金额</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="money4" id="money4" lay-verify="nonnegative" placeholder="金额" value="0" />
                                        </div>
                                    </div>
                                    <div class="blocks">
                                        <label>TI*HI</label>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" name="tihi" id="tihi" lay-verify="tihi"  placeholder="*"/>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item" style="margin: 2rem 0;">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="add">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>
<script th:src="@{/plugin/beyond/assets/js/fuelux/wizard/wizard-custom.js}"></script>

<script>

    var userid = localStorage['id'];

    // 数据回显数据查询的ajax
    function Assignment () {
        var successdata;
        $.ajax({
            url: '/zxsdwms/wmspacking/getWmsPacking/' + userid,
            type: 'GET',
            dataType: 'json',
            contentType: "application/json",
            async: false,
            data: '',
            success: function (data) {
                successdata = data;
                $('#packName').val(data.bzmc);
                $('#packDescribe').val(data.bzms);
                for (var i = 0;i < 4; i++) {
                    var item = data.list[i];
                    var j = parseInt(item.bzlx) + 1;
                    $('#number' + j).val(item.zdwsl);
                    $('#describe' + j).val(item.ms);
                    $('#length' + j).val(item.c);
                    $('#width' + j).val(item.k);
                    $('#height' + j).val(item.g);
                    $('#volume' + j).text(item.tj);
                    $('#rough' + j).val(item.zl);
                    $('#suttle' + j).val(item.jz);
                    $('#money' + j).val(item.je);
                    $('#mxid' + j).val(item.mxid);
                    if (j == 4) {
                        console.log('tihitihi', item, item.th);
                        $('#tihi').val(item.th);
                    }
                }
            },
            error: function () {
                layer.msg('error');
            },
        });
        return successdata.list;
    }

    function Fixed (data) {
        var datastr = data.toString();
        var len = datastr.indexOf('.');
        if (len > 0){
            console.log(datastr.substring(0, len + 5));
            return parseFloat(datastr.substring(0, len + 5)).toFixed(3);
        } else {
            return data;
        }
    }

    function returnpage() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    }
    layui.use(['myform','zzpUtils','form','laydate','jquery','zzpValidation'],function () {
        var form = layui.form,
            zzpUtils = layui.zzpUtils
            ,laydate = layui.laydate
            ,zzpValidation = layui.zzpValidation
            ,$ = layui.jquery;

        Assignment();

        form.verify({
            zhengshu: function (value) {
                var result = zhengshu(value);
                if (result != "Y") {
                    return result;
                }
            },
            zhengshu2:function (value) {//包含0 的正数
                var result = zhengshu2(value);
                if (result != "Y") {
                    return result;
                }
            },
            nonnegative:function (value) {
                var result = nonnegative(value);
                if (result != "Y") {
                    return result;
                }
            },
            tihi:function (value) {
                var result = TIHI(value);
                if (result != "Y") {
                    return result;
                }
            }

        });
        function zhengshu(value) {
            /*var reg = /^\+?((0|([1-9]+\d*))|((0\.\d+)|([1-9]+\d*\.\d+)))$/;*/
            var reg=/^[1-9]{1,}[\d]*$/;//不包含0的正整数
            if (reg.test(value)) {
                return "Y";
            }
            return "请输入正整数";
        }
        function zhengshu2(value) {//包含0的正数
            var reg = /^([1-9]\d*|[0]{1,1})$/;//包含0 的正整数
            if (reg.test(value)) {
                return "Y";
            }
            return "请输入正整数";
        }
        //非负数
        function nonnegative(value) {
            /*var reg = /^\+?((0|([1-9]+\d*))|((0\.\d+)|([1-9]+\d*\.\d+)))$/;*/
            var reg=/^\d+(\.{0,1}\d+){0,1}$/;//包含0 的整数
            if (reg.test(value)) {
                return "Y";
            }
            return "请输入非负数";
        }

        //校验TIHI值
        function TIHI(value) {
//            var len = value.indexOf('*');
//            if (len > 0 && len < value.length) {
//
//            }
            var reg=/^[0-9]+[*][0-9]+|[*]$/;
            if (reg.test(value)) {
                return "Y";
            }
            return "请输入符合‘xx*xx’或'*'格式的值";
        }

//        $.ajax({
//            url: '/zxsdwms/wmspacking/getWmsPacking/' + localStorage['id'],
//            type: 'GET',
//            dataType: 'json',
//            contentType: "application/json",
//            async: false,
//            data: '',
//            success: function (data) {
//                console.log('dddddddddddata', data);
//                $('#packName').val(data.bzmc);
//                $('#packDescribe').val(data.bzms);
//                for (var i = 0;i < 4; i++) {
//                    var j = i + 1;
//                    var item = data.list[i];
//                    $('#number' + j).val(item.zdwsl);
//                    $('#describe' + j).val(item.ms);
//                    $('#length' + j).val(item.c);
//                    $('#width' + j).val(item.k);
//                    $('#height' + j).val(item.g);
//                    $('#volume' + i).text(item.tj);
//                    $('#rough' + j).val(item.zl);
//                    $('#suttle' + j).val(item.jz);
//                    $('#money' + j).val(item.je);
//                    if (i === 3) {
//                        $('#tihi').val(item.th);
//                    }
//                }
//            },
//            error: function () {
//                layer.msg('error');
//            },
//        });

        // 监听height1
        $('#length1').on('input propertychange', function(data) {
            var volume = 0;
            var length =  data.currentTarget.value;
            if (length !== '') {
                length = parseFloat(length);
            }
            var height = $('#height1').val();
            height = parseFloat(height);
            var width = $('#width1').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                console.log(111111, length, height, width);
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume1').text(volume);
            }
        })
        // 监听height1
        $('#length2').on('input propertychange', function(data) {
            var volume = 0;
            var length =  data.currentTarget.value;
            if (length !== '') {
                length = parseFloat(length);
            }
            var height = $('#height2').val();
            height = parseFloat(height);
            var width = $('#width2').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume2').text(volume);
            }
        })
        // 监听height1
        $('#length3').on('input propertychange', function(data) {
            var volume = 0;
            var length =  data.currentTarget.value;
            if (length !== '') {
                length = parseFloat(length);
            }
            var height = $('#height3').val();
            height = parseFloat(height);
            var width = $('#width3').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume3').text(volume);
            }
        })
        // 监听height1
        $('#length4').on('input propertychange', function(data) {
            var volume = 0;
            var length =  data.currentTarget.value;
            if (length !== '') {
                length = parseFloat(length);
            }
            var height = $('#height4').val();
            height = parseFloat(height);
            var width = $('#width4').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume4').text(volume);
            }
        })


        // 监听width1
        $('#width1').on('input propertychange', function(data) {
            var volume = 0;
            var width =  data.currentTarget.value;
            if (width !== '') {
                width = parseFloat(width);
            }
            var height = $('#height1').val();
            height = parseFloat(height);
            var length = $('#length1').val();
            length = parseFloat(length);
            if (width !== '' && length !== '' && width !== '') {
                console.log(222222, length, height, width);
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume1').text(volume);
            }
        })
        // 监听width1
        $('#width2').on('input propertychange', function(data) {
            var volume = 0;
            var width =  data.currentTarget.value;
            if (width !== '') {
                width = parseFloat(width);
            }
            var height = $('#height2').val();
            height = parseFloat(height);
            var length = $('#length2').val();
            length = parseFloat(length);
            if (width !== '' && length !== '' && width !== '') {
                console.log(222222, length, height, width);
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume2').text(volume);
            }
        })
        // 监听width1
        $('#width3').on('input propertychange', function(data) {
            var volume = 0;
            var width =  data.currentTarget.value;
            if (width !== '') {
                width = parseFloat(width);
            }
            var height = $('#height3').val();
            height = parseFloat(height);
            var length = $('#length3').val();
            length = parseFloat(length);
            if (width !== '' && length !== '' && width !== '') {
                console.log(222222, length, height, width);
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume3').text(volume);
            }
        })
        // 监听width1
        $('#width4').on('input propertychange', function(data) {
            var volume = 0;
            var width =  data.currentTarget.value;
            if (width !== '') {
                width = parseFloat(width);
            }
            var height = $('#height4').val();
            height = parseFloat(height);
            var length = $('#length4').val();
            length = parseFloat(length);
            if (width !== '' && length !== '' && width !== '') {
                console.log(222222, length, height, width);
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume4').text(volume);
            }
        })


        // 监听height1
        $('#height1').on('input propertychange', function(data) {
            var volume = 0;
            var height =  data.currentTarget.value;
            if (height !== '') {
                height = parseFloat(height);
            }
            var length = $('#length1').val();
            length = parseFloat(length);
            var width = $('#width1').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                console.log(333333, length, height, width);
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume1').text(volume);
            }
        })
        // 监听height1
        $('#height2').on('input propertychange', function(data) {
            var volume = 0;
            var height =  data.currentTarget.value;
            if (height !== '') {
                height = parseFloat(height);
            }
            var length = $('#length2').val();
            length = parseFloat(length);
            var width = $('#width2').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume2').text(volume);
            }
        })
        // 监听height1
        $('#height3').on('input propertychange', function(data) {
            var volume = 0;
            var height =  data.currentTarget.value;
            if (height !== '') {
                height = parseFloat(height);
            }
            var length = $('#length3').val();
            length = parseFloat(length);
            var width = $('#width3').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume3').text(volume);
            }
        })
        // 监听height1
        $('#height4').on('input propertychange', function(data) {
            var volume = 0;
            var height =  data.currentTarget.value;
            if (height !== '') {
                height = parseFloat(height);
            }
            var length = $('#length4').val();
            length = parseFloat(length);
            var width = $('#width4').val();
            width = parseFloat(width);
            if (width !== '' && length !== '' && width !== '') {
                volume = length * height * width;
                volume = Fixed(volume);
                $('#volume4').text(volume);
            }
        })

        // 修改保存
        form.on("submit(add)",function(data){
            zzpUtils.confirm("是否确定修改？",function(index){
                var field = data.field;
                var values = {}, list = [];
                values['bzmc'] = field.packName;// 包装名称
                values['bzms'] = field.packDescribe;// 包装描述
                for (var i = 1; i < 5; i++) {
                    var lis = {};
                    lis['zdwsl'] = field['number' + i]; //数量
                    lis['ms'] = field['describe' + i]; // 包装描述
                    lis['c'] = field['length' + i]; // 长
                    lis['k'] = field['width' + i]; //宽
                    lis['g'] = field['height' + i]; // 高
                    lis['tj'] = $('#volume' + i).text();// 体积
                    lis['zl'] = field['rough' + i]; // 毛重
                    lis['jz'] = field['suttle' + i]; // 净重
                    lis['je'] = field['money' + i]; // 金额
                    lis['mxid'] = field['mxid' + i];
                    lis['th'] = '*';
                    switch (i) {
                        case 1: lis['bzlx'] = 0;
                            list.push(lis);
                            break;
                        case 2: lis['bzlx'] = 1;
                            list.push(lis);
                            break;
                        case 3: lis['bzlx'] = 2;
                            list.push(lis);
                            break;
                        case 4: lis['bzlx'] = 3;
                            lis['th'] = $('#tihi').val();
                            list.push(lis);
                            break;
                    }
                }
                values['list'] = list;
                values['id'] = userid;
                console.log('valuesvalues', JSON.stringify(values));
                zzpUtils.action({
                    url:"/wmspacking/edit",
                    data:JSON.stringify(values),
                    success:function (data) {
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            top.layer.msg(data.title + '<br>' + data.message);
                            //刷新父页面
                            // parent.location.reload();
                        },500);
                    },error: function (xhr, textStatus) {
                        console.log(textStatus);
                        console.log(xhr)
                    }
                })
            })
            return false;
        })

        $('#simplewizardinwidget').wizard().on('change',function (e,step) {
            if(step.direction =="next"){
                return zzpValidation.validation("#addForm #simplewizardinwidgetstep"+step.step);
            }
        });
        $('#simplewizardinwidget').wizard().on('finished',function () {
            alert("结束啦");
        });
        laydate.render({
            elem: '#test1'
            ,theme: '#20a0ff'
            ,type: 'datetime'
        })
        laydate.render({
            elem: '#test2'
            ,theme: '#20a0ff'
            ,type: 'datetime'
        })


        window.operateEvent ={
            "click .layui-btn-primary":function (e, value, row, index) {
                alert(row.mc);
            }
        }

    });
</script>
</html>